package com.habitracker;

import com.habitracker.controller.DataManager;
import com.habitracker.view.HabitPage;
import com.habitracker.view.ProgressPage;
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.stage.Stage;

public class Main extends Application {

    @Override
    public void start(Stage primaryStage) {
        DataManager dataManager = new DataManager();

        // 创建标签页
        TabPane tabPane = new TabPane();
        tabPane.setPrefSize(800, 600); // 固定大小

        // 习惯标签页
        Tab habitTab = new Tab("习惯跟踪");
        HabitPage habitPage = new HabitPage(dataManager);
        habitTab.setContent(habitPage.getLayout());
        habitTab.setClosable(false);

        // 进度标签页
        Tab progressTab = new Tab("目标进度");
        ProgressPage progressPage = new ProgressPage(dataManager);
        progressTab.setContent(progressPage.getLayout());
        progressTab.setClosable(false);

        tabPane.getTabs().addAll(habitTab, progressTab);

        // 设置场景 - 固定800×600
        Scene scene = new Scene(tabPane, 800, 600);

        // 配置舞台 - 禁止调整大小
        primaryStage.setTitle("智能习惯养成器");
        primaryStage.setScene(scene);
        primaryStage.setWidth(800);
        primaryStage.setHeight(600);
        primaryStage.setResizable(false); // 禁止调整窗口大小
        primaryStage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}